<?php
/*
===========================================================================

  Copyright (c) 2010-2012 DSPWeb Development Team

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see http://www.gnu.org/licenses/

  This file is part of DSPWeb source code

===========================================================================
*/

$output .= '
<br /><table width="85%" border="0" style="border: 1px solid #c0c0c0;" cellpadding=0 cellspacing=0>
  <tr>
    <td style="background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; padding: 5px; font-weight: bold; font-size: 12px; color: #3f6fbc;">Region Information - '.getRegionName($id).'</td>
  </tr>
  <tr>
    <td style="padding: 10px;"><center>
		<table border=0 width=100%>
	<tr>
	<td style="text-align: left;">&nbsp;</td>
	</tr>
	</table>
	<form method="post" action="characters.php">
	<input type="hidden" name="charpage" value="1">
	<input type="hidden" name="char" value="1">
	<input type="hidden" name="page" value="View Character">';
	if ($sql->num_rows($q) > 0) {
		$output .= '
		<table width="100%" border="0" cellpadding=0 cellspacing=0 style="border: 1px solid #c0c0c0;">
		  <tr>
			<th width="5%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center; padding: 5px;">&nbsp;</th>
			<th width="22%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Character</th>
			<th width="9%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Race</th>
			<th width="9%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Gender</th>
			<th width="7%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Job</th>
			<th width="7%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Level</th>
			<th width="41%" style="font-size: 10px; font-weight: bold; background-color: #F1F3F5; border-bottom: 1px solid #c0c0c0; text-align: center;">Area</th>
		  </tr>';
		
		while ($char = $sql->fetch_array($q))  {
			$output .= '
		  <tr class="charinfo">
			<td class="charinfo"><input type="radio" name="charid" value="'.$char['charid'].'"></td>
			<td class="charinfo">'.$char['charname'].'</td>
			<td class="charinfo">'.getCharRace($char['charid']).'</td>
			<td class="charinfo">'.getCharGender($char['charid']).'</td>
			<td class="charinfo">'.getJobName(getCharJob($char['charid'],"main")).'</td>
			<td class="charinfo">'.getJobLevel($char['charid'],getCharJob($char['charid'],"main")).'</td>
			<td class="charinfo" style="text-align: center;">'.getZoneName(getCharZone($char['charid'])).'</td>
		  </tr>';
		}
		$output .= '
			  </table>
			<table border=0 width=100%>
			<tr>
			<td style="text-align: center;">
			  <input type="submit" name="page" value="View Character"><br/></td>
			</tr>
			</table>';
	}
	else {
		$output .= '<span style="text-align: left; font-size: 12px;">No characters found in this region</span>';
	}
	
	if ($total_results > $limit) {
		$output .= '[<a href="region.php?id='.$id.'&page=1" style="font-size: 12px;"><<</a>&nbsp;';
		
		for($i=1; $i<=$total_pages; $i++) {
			$output .= '<a href="region.php?id='.$id.'&page='.$i.'" style="font-size: 12px;">'.$i.'</a>&nbsp;';
		}
		
		$output .= '<a href="region.php?id='.$id.'&page='.$total_pages.'" style="font-size: 12px;">>></a>]';
	}
	$output .= '
	</form>
	  <br/>
    </center></td>
  </tr>
</table></center><br />';

?>